<#include "layout/template.ftl"/>

<@htmlHead title="权限列表">
		<!-- page specific plugin styles -->
		<link rel="stylesheet" href="${resources}/assets/css/jquery-ui.css" />
		<link rel="stylesheet" href="${resources}/assets/css/datepicker.css" />
		<link rel="stylesheet" href="${resources}/assets/css/ui.jqgrid.css" />
		<link rel="stylesheet" href="${resources}/plugins/jqgrid/4.6/jqgrid.extend.css" />
</@htmlHead>


 
<@htmlBody 'system' 'permissionManage'>

	<!-- breadcrumbs begin -->
	<#include "layout/breadcrumbs.ftl">
	<@breadcrumbs '权限管理' '权限列表'></@breadcrumbs>
	<!-- breadcrumbs start -->

	<!-- page-content begin -->
	<div class="page-content">
	
		<!-- page-header begin -->
		<div class="page-header">
			<h1>
				<i class="fa fa-trophy"></i>&nbsp;权限列表
				<a href="${path}/manage/system/permission/create" class="btn btn-warning pull-right"> 新 增</a>
				<!--
				<input id="btnSubmit" class="btn btn-primary pull-right" type="button" value="保存排序" onclick="updateSort();"/>
				-->
			<h1>
		</div>
		<!-- page-header end -->
			
			
		<form id="listForm" method="post">	
		<table id="treeTable" class="table table-striped table-bordered table-condensed ">
			<thead>
				<tr>
				<th>名称</th>
				<th>类型</th>
				<th>链接</th>
				<th style="text-align:center;">排序</th>
				<th>可见</th>
				<th>权限标识</th>
				<th>操作</th>
				</tr>
			</thead>
			<tbody>
			<#list list as permission>
				<tr id="${permission.id}" pId="${(permission.parent.id!=1)?string(permission.parent.id,0)}" style="display:${(permission.state=='open')?string('table-row','none')}" >
					<td nowrap><a href="${path}/manage/system/permission/${permission.id}">${permission.name}</a></td>
					<td>${(permission.type==1)?string('菜单','按钮')}</td>
					<td title="${permission.url}">${permission.url}</td>
					<td style="text-align:center;">
						<@shiro.hasPermission name="system:permission:update">
							<input type="hidden" name="ids" value="${permission.id}"/>
							<input name="seq" type="text" value="${permission.seq}" style="width:50px;margin:0;padding:0;text-align:center;">
						</@shiro.hasPermission>
					</td>
					<td>${(permission.state=='open')?string('显示','隐藏')}</td>
					<td title="${permission.permission}">${permission.permission}</td>
					<@shiro.hasPermission name="system:permission:update">
					<td nowrap>
						<a href="${path}/manage/system/permission/update/${permission.id}">修改</a>
						<a href="${path}/manage/system/permission/delete/${permission.id}" onclick="return confirm('要删除该菜单及所有子菜单项吗？', this.href)">删除</a>
						<!--
						<a href="${path}/manage/system/permission/create?parentid=${permission.id}">添加下级菜单</a> 
						-->
					</td>
					</@shiro.hasPermission>
				</tr>
			</#list>
			</tbody>
		</table>
		</form>
		
		
			
	</div>		
	<!-- page-content end -->	


</@htmlBody>



<@htmlBodyScript>
	
	<link href="${resources}/plugins/treeTable/themes/vsStyle/treeTable.min.css" rel="stylesheet" type="text/css" />
	<script src="${resources}/plugins/treeTable/jquery.treeTable.min.js" type="text/javascript"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#treeTable").treeTable({expandLevel : 3}).show();
		});
    	function updateSort() {
			//loading('正在提交，请稍等...');
	    	$("#listForm").attr("action", "${path}/manage/system/permission/updateSort");
	    	$("#listForm").submit();
    	}
	</script>
</@htmlBodyScript>